from passlib.context import CryptContext

pwd = CryptContext(schemes=['argon2'], deprecated='auto')


# 密码加密
def hash_password(password: str) -> str:
	hashed_password = pwd.hash(password)
	return hashed_password


def verify_password(plain_password: str, hashed_password: str) -> bool:
	# 验证明文密码是否与存储的哈希密码匹配
	return pwd.verify(plain_password, hashed_password)
